"""工具模块"""

import os
from pathlib import Path


def get_project_root() -> str:
    """
    获取项目根目录

    Returns:
        str: 项目根目录绝对路径
    """
    return os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


def load_config() -> dict:
    """
    加载配置文件

    Returns:
        dict: 配置字典
    """
    import yaml
    config_path = os.path.join(get_project_root(), 'config', 'config.yaml')
    with open(config_path, 'r', encoding='utf-8') as f:
        return yaml.safe_load(f)


# 导出logger模块的功能
from readlater.utils.logger import setup_logging, get_logger, logger

__all__ = [
    'get_project_root',
    'load_config',
    'setup_logging',
    'get_logger',
    'logger'
]